import request from '@/config/axios'

// 数据库备份 VO
export interface BackupVO {
  id: number // 编号
  sqlName: string // sql文件名称
  filePath: string // 文件路径
  status: number // 状态: 0 生成中，1生成成功，2生成失败
}

// 数据库备份 API
export const BackupApi = {
  // 查询数据库备份分页
  getBackupPage: async (params: any) => {
    return await request.get({ url: `/jikong/backup/page`, params })
  },

  // 查询数据库备份详情
  getBackup: async (id: number) => {
    return await request.get({ url: `/jikong/backup/get?id=` + id })
  },

  // 新增数据库备份
  createBackup: async (data: BackupVO) => {
    return await request.post({ url: `/jikong/backup/create`, data })
  },

  // 修改数据库备份
  updateBackup: async (data: BackupVO) => {
    return await request.put({ url: `/jikong/backup/update`, data })
  },

  // 删除数据库备份
  deleteBackup: async (id: number) => {
    return await request.delete({ url: `/jikong/backup/delete?id=` + id })
  },

  // 导出数据库备份 Excel
  exportBackup: async (params) => {
    return await request.download({ url: `/jikong/backup/export-excel`, params })
  }
}